<?php


namespace app\studentLayer\controller;

use think\Controller;
use think\Db;


//作为登录用
class TeacherLogin extends Controller
{

    public function Teacher_Login()
    {

        if ($this->request->isPost()) {

            $Select = $this->request->post();

            $Get_Teacher = Db::table('s_teacher')->get($Select);
            //var_dump($Select,$Get_Teacher);die;
            if($Get_Teacher){

                session('Teacher',$Get_Teacher);
//                var_dump(1);die;
                return redirect('/studentLayer/Teacher_Base/Teacher_Base');

            }else{
                return $this->error('登录失败','studentLayer/TeacherLogin/Teacher_Login');
            }

            //重定向到登录需要验证的类中
        } else {
            return $this->fetch('/LoginView/Teacher_Login');

        }
    }


    public function Teacher_Out()
    {
        session('Teacher',null);
        return redirect('/studentLayer');

    }

}